package com.myspring.aop.eg.example;

public class CalculatorStaticProxy implements Calculator {

    //被代理的目标对象传递过来
    private Calculator calculator;

    public CalculatorStaticProxy(Calculator calculator) {
        this.calculator = calculator;
    }

    @Override
    public int add(int a, int b) {
        System.out.println("[日志] add 方法开始了，参数是：" + a + "," + b);

        //调用目标对象的方法实现核心业务
        int addResult = calculator.add(a, b);

        System.out.println("[日志] add 方法结束了，结果是：" + addResult);
        return 0;
    }

    @Override
    public int subtract(int a, int b) {
        return 0;
    }

    @Override
    public int multiply(int a, int b) {
        return 0;
    }

    @Override
    public int divide(int a, int b) {
        return 0;
    }
}
